package com.cndongtai.dao.impl;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Repository;

import com.cndongtai.dao.BaseDao;
import com.cndongtai.dao.inter.UploadFileMapper;
import com.cndongtai.po.UploadFile;

@Repository("uploadDao")
public class UploadDao extends BaseDao implements UploadFileMapper {

	@Override
	public int saveUploadFile(UploadFile uploadFile) {
		SqlSession sqlSession = getSqlSession();
		try {
			UploadFileMapper operation = sqlSession.getMapper(UploadFileMapper.class);
			return operation.saveUploadFile(uploadFile);
		}catch(Exception e) {
			e.printStackTrace();
		}finally {
			sqlSession.close();
		}
		
		return 0;
	}

	@Override
	public UploadFile queryUploadFileById(Long id) {
		SqlSession sqlSession = getSqlSession();
		try {
			UploadFileMapper operation = sqlSession.getMapper(UploadFileMapper.class);
			return operation.queryUploadFileById(id);
		}catch(Exception e) {
			e.printStackTrace();
		}finally {
			sqlSession.close();
		}
		
		return null;
	}

}
